﻿using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using PHMEE.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

namespace PHMEE.Repositories.DaqInfo.Dt
{
    public class SysParaExtendRepository : EfCoreRepository<PHMEEDbContext, SysParaExtend, Guid>, ISysParaExtendRepository
    {
        public SysParaExtendRepository(IDbContextProvider<PHMEEDbContext> dbContextProvider) : base(dbContextProvider)
        {

        }
        /// <summary>
        ///  根据编号获取当前数采器
        /// </summary>
        /// <param name="code">数采器编码</param>
        /// <returns></returns>
        public async Task<SysParaExtend> GetSysParaExtendAsync(string code)
        {
            var dbContext = await GetDbContextAsync();
            //查询是否存在
            return await dbContext.SysParaExtendeds.FirstOrDefaultAsync(x => x.Code == code);
        }
    }
}
